package top.likeqc.leetcode.editor.cn;

/**
 * @see <a href="https://leetcode.cn/problems/count-asterisks">leetcode题库</a>
 */
public class CountAsterisks {
    public static void main(String[] args) {
        Solution solution = new CountAsterisks().new Solution();
    }
    // leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        public int countAsterisks(String s) {
            int verticalCount = 0;
            int ans = 0;
            for (int i = 0; i < s.length(); i++) {
                char c = s.charAt(i);
                if (c == '|') {
                    verticalCount++;
                }
                if (c == '*' && verticalCount % 2 == 0) {
                    ans++;
                }
            }
            return ans;
        }
    }
    // leetcode submit region end(Prohibit modification and deletion)

}
